package com.lr.dao.internet.impl;

import com.lr.dao.internet.internetDao_list;
import com.lr.domain.INetSaler;
import com.lr.domain.INet_list;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("inetrnet")
public class internetDaoimplList implements internetDao_list {

    @Autowired
    JdbcTemplate jdbcTemplate;
    static List<INetSaler> list=INet_list.get_list();
 /*  public static void main(String []args)
    {   int i=0;
        for(INetSaler iNetSaler: list)

        {
            if(iNetSaler.getMg_name().equals("lee_1"))
        {
            break;

        }
         i++;

        }
        list.remove(i);
        for(INetSaler iNetSalers: list)

        {
            System.out.println(iNetSalers);
        }
    }*/

    public void add_info(INetSaler iNetSaler)
    {

        list.add(iNetSaler);

    }

    public void delet_info(int id) {
       int i=0;
       for (INetSaler iNetSaler:list)
       {   if (iNetSaler.getNumber()==id)
        {
            break;
        }
          i++;
       }
        list.remove(i);
    }



    public void change_info(int id,INetSaler iNetSalers) {
        int i=0;
        for (INetSaler iNetSaler:list)
        {   if (iNetSaler.getNumber()==id)
        {
            break;
        }
            i++;
        }
        list.remove(i);
        list.add(iNetSalers);
    }

    public List<INetSaler> find_all() {
        return list;
    }
}
